package com.hyd.manage.mapper;

import java.util.List;
import com.hyd.manage.domain.Sales;
import com.hyd.manage.domain.SalesRecord;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * post销售Mapper接口
 * 
 * @author hwb
 * @date 2025-02-19
 */
public interface SalesMapper 
{
    /**
     * 查询post销售
     * 
     * @param medicineCode post销售主键
     * @return post销售
     */
    @Select("select * from hyd.tb_medicines where medicine_code = #{medicineCode}")
    public Sales selectSalesByBatchNumber(String medicineCode);

    /**
     * 查询post销售列表
     * 
     * @param sales post销售
     * @return post销售集合
     */
    public List<Sales> selectSalesList(Sales sales);

    /**
     * 新增post销售
     * 
     * @param sales post销售
     * @return 结果
     */
    public int insertSales(Sales sales);

    /**
     * 修改post销售
     * 
     * @param sales post销售
     * @return 结果
     */
    public int updateSales(Sales sales);

    /**
     * 删除post销售
     * 
     * @param id post销售主键
     * @return 结果
     */
    public int deleteSalesById(Long id);

    /**
     * 批量删除post销售
     * 
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteSalesByIds(Long[] ids);

    /**
     * 0改为1
     */
    @Update("update hyd.tb_sales set status = 1 where status = 0")
    public int deleteAll();

    /**
     * 查询所有
     * @param salesRecord
     * @return
     */
    public List<SalesRecord> selectSalesAll(SalesRecord salesRecord);

    /**
     * 挂单
     * @param ids
     * @return
     */
    public int hangSalesByIds(Long[] ids);

    /**
     * 根据id查询
     * @param id
     * @return
     */
    @Select("select * from hyd.tb_sales where id = #{id}")
    public SalesRecord selectSalesById(Long id);

    /**
     * 根据状态查询
     * @param
     * @return
     */
    @Select("select * from hyd.tb_sales where status = 1")
    public List<SalesRecord> selectSalesAllByStatus(SalesRecord salesRecord);
}
